<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <script src="js/jquery-3.2.1.js"></script>
</head>
<body>
<span>hello</span>
<div>
    <span>姓名：</span><input id="name"/>
    <span>密码：</span><input id="password"/>
    <span>手机号：</span><input id="phone"/>
    <button id="submit">提交</button>
</div>
</body>
<script>
$(function (){
    alert(1);
    $("#submit").click(function () {
        alert(2);
        var user = {
            "name":$("#name").val(),
            "password":$("#password").val(),
            "phone":$("#phone").val()
        };

        $.ajax({
            type: 'post',
            url: "/addH",
            data : user,
            success: function(data){
                alert(data.msg);
            },
            error:function(data){
                alert("出错了！！:"+data.msg);
            }
        });
    })


});
</script>
</html>